//
//  JHUserDefaultsStorage.m
//  MiniWeChat
//
//  Created by ByteDance on 2025/6/25.
//

#import "JHUserDefaultsStorage.h"

@implementation JHUserDefaultsStorage {
    NSUserDefaults *_defaults;
}

- (instancetype)initWithConfiguration:(NSDictionary *)configuration {
    self = [super init];
    if (self) {
        _defaults = [NSUserDefaults standardUserDefaults];
    }
    return self;
}

- (BOOL)saveObject:(id<NSCoding>)object forKey:(NSString *)key error:(NSError **)error {
    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:object];
    [_defaults setObject:data forKey:key];
    return [_defaults synchronize];
}

// 其他方法实现...
@end
